package org.example.myerp.controller;

import java.util.List;

import javax.servlet.http.HttpSession;


import org.example.myerp.pojo.Tree;
import org.example.myerp.pojo.User;
import org.example.myerp.service.ModuleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
//
//@CrossOrigin(methods = { RequestMethod.POST, RequestMethod.GET }, allowCredentials = "true", allowedHeaders = "*")

@RestController
@RequestMapping("/system/module")
public class ModuleController {

	@Autowired
	private ModuleService moduleService;

	@RequestMapping("/getModule")
	public List<Tree> getModule(String moduleName, Integer uid, HttpSession session) {
		User user = (User) session.getAttribute("user");
//		return moduleService.getModule(moduleName, user.getUid());
        return moduleService.getModule(moduleName,user.getUid());
	}

}
